//
//  SWComposeDTO.swift
//  新浪微博
//
//  Created by Mac on 17/1/3.
//  Copyright © 2017年 itcast. All rights reserved.
//

import UIKit

class SWComposeDTO: NSObject {
    
    var imageName:String = "compose_keyboardbutton_background"
    var title:String = "文字"
    
    // 使用 KVC 构造对象
    init(dict: [String:Any]) {
        super.init()
        setValuesForKeys(dict)
        
    }
    
    // 为了防止因为属性少于字典键值对数量,重写
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
    }
    
    
    // 提供方法,返回对象数组
    class func getDTOArray(array: [[String:Any]]) -> [SWComposeDTO] {
        
        var mutableArray: [SWComposeDTO] = []
        
        for dict in array {
            let DTO:SWComposeDTO = SWComposeDTO(dict: dict)
            mutableArray.append(DTO)
        }
        return mutableArray
    }

}
